In a small network, multiple nodes, or “hosts” are connected to one single network segment and share the communications bandwidth available to that segment. However, when the amount of data traffic on the segment increases to a certain point, the network becomes congested. A network switching device/bridge can be inserted to break the network into multiple segments. By electrically and physically separating the data traffic into different segments and allowing the inter-segment data traffic to be transmitted only when necessary across the switch, the switch increases the total aggregated available communications bandwidth of the network. Typically, the switch forwards or filters (e.g., discards) inter-segment data packets using Layer-2 Media Access Control (MAC) address information obtained from a header in each of the data packets.
A switch receives data packets on each segment of the network to which one of its ports is connected and learns the location of nodes in the network by examining the source MAC address of each received data packet. Source MAC addresses may be dynamically “learned”, that is, stored in a database once a packet is received that specifies the source MAC address, or may be statically configured, that is, added by a network manager to the database rather than learned. Each database entry includes, among other information, a source MAC address and a port number for the port via which the switch received the data packet specifying the source MAC address. Traditionally, this database is referred to as a Forwarding Database (FDB). The purpose of the FDB is to identify the location of each host, that is, the switch port connected to the network segment via which a data packet sourced by the host were received, so that when the switch thereafter receives a data packet specifying the host's MAC address as the destination MAC address, it searches the FDB for the MAC address and forwards the data packet to the appropriate destination host via the switch port specified in the same entry in the FDB.
Simply, a switch learns the source MAC address specified in the header of a data packet it receives by creating an entry in the FDB, the entry including the source MAC address and the port number of the port via which the packet was received. The switch also looks up in the FDB the destination MAC address specified in the header of the data packet, and forwards the packet to the appropriate switch port specified in the FDB if a matching entry is found. If no match is found then the packet is flooded to all ports on the switch in an attempt to ensure the packet reaches its destination.
Entries in the forwarding database are constantly updated and aged out (i.e., removed after a period of time) to ensure the accuracy of the database and also to keep the database as small as possible. A switch maintains, for example, an age counter, and each entry in the FDB gets time-stamped with the current value of the age counter when an entry is created. When the entry gets to a pre-defined age, the entry is removed from the FDB. This protects the FDB from stale, and over-population of unused, entries and forces the switch to re-learn source MAC addresses periodically. In order to prevent unnecessary flooding of packets due to re-learning, the FDB time-stamp associated with a particular source MAC address is updated whenever the source MAC address is detected in a received packet.
As can be appreciated, there are many operations performed on the FDB to manage the accuracy and size of its content. It is, therefore, desirable to be able to perform these operations as quickly and efficiently as possible.